<%@page import="helpers.UrlHelper"%>
<%@page import="entities.KeywordRanking"%>
<% 
String name  = (String) request.getAttribute("name");
KeywordRanking keyword = (KeywordRanking) request.getAttribute("keyword");
String error = (String) request.getAttribute("error");

//Set content for Seo
String title = "Check Keyword Ranking - a " + UrlHelper.getDomainServer(request) + " tool FREE";
String description = "Tool show where your site ranks for a keyword but won't help you rank higher. This is a " + UrlHelper.getDomainServer(request) + " tool FREE";
String keywords = "show domain, whois, key word, keyword, engine search, rank, DNS Record Analysis, Traffic Analysis, Site Technical Analysis, ip Analysis, Page Analysis and HTML Analysis";
String url = UrlHelper.getServerUrl(request) + "/keyword-ranking";

if (keyword != null) {
	title = "Keyword Ranking  " + keyword.getDomain() + " information in " + UrlHelper.getDomainServer(request);
	description = "Ranking Keyword for domain " + keyword.getDomain() + ". Tool show where your site ranks for a keyword but won't help you rank higher"; 
	keywords = keyword.getDomain() + ", " + keywords;
	url = url + "?q=" + keyword.getDomain();
}
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

	<script type="text/javascript" src="/js/keyword_ranking.js"></script>
	
	<div id="content">
		<jsp:include page="/elements/search_bar.jsp" />
		
		<div class="row">
			<!-- Left Content BEGIN -->
			<div class="span9">
				<section class="check-page">
					<div class="box1 block">
						<h3 class="title">Check Keyword Ranking</h3>
						<div class="row-fluid border-space">
							<div class="span6 search-bar2">
								<div class="item-stream unstyled search-input-stream">
									<div class="stream-item stream-header search-input-item">
										<form class="form-inline search-form" action="/keyword-ranking">
											<input type="text" value="" placeholder="ex: google.com" name="q" id="artist_search" class="xlarge ui-autocomplete-input" role="textbox">
					          				<button type="submit" id="artist_submit" class="btn btn-large btn-inverse"><i class="icon-search icon-white"></i></button>
										</form>
									</div>
								</div>
							</div>
						</div>

						<div class="result">
							<% if (name == null) { %>
								<p>Please enter a domain name.</p>
							<% } %>
							<br />
							<div class="adv">
								<script type="text/javascript"><!--
								google_ad_client = "ca-pub-4975603569119809";
								/* showdomain 468x60 */
								google_ad_slot = "3934035319";
								google_ad_width = 468;
								google_ad_height = 60;
								//-->
								</script>
								<script type="text/javascript"
								src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
								</script>
							</div>
							<% if (keyword != null) { %>
							<section class="ip-result">
								<div class="block">
									<h3 class="title"><%=keyword.getDomain() %> Ranking Analysis</h3>
									
									<div class="adv left">
										<script type="text/javascript"><!--
										google_ad_client = "ca-pub-4975603569119809";
										/* showdomain 468x15 */
										google_ad_slot = "8143908917";
										google_ad_width = 468;
										google_ad_height = 15;
										//-->
										</script>
										<script type="text/javascript"
										src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
										</script>
									</div>
									
									<div class="content-block">
										<% if (keyword.getPositionContent().isEmpty()) { %>
										<div class="row-fluid f-info">
											<div class="span12">
												Sorry, we currently do not collect enough data for <%=keyword.getDomain() %>.
											</div>
										</div>
										<% } else { %>
										<script type="text/javascript" src="http://www.google.com/jsapi"></script>
										<script type="text/javascript">
										<%=keyword.getChartJs() %>
										</script>
										
										<div class="row-fluid f-info">
											<div class="span12">
												<h4><%=keyword.getDomain() %> Ranking Position Analysis</h4>
												<ul>
													<li>
														<div id="chart_div_pie"></div>
													</li>
													<li>
														<br />
														<%=keyword.getPositionContent() %>
													</li>
												</ul>
												
												<h4><%=keyword.getDomain() %> keywords by time</h4>
												<ul>
													<li>
														<div id="chart_div_line"></div>
													</li>
												</ul>
												
												<br />
												<div class="adv">
													<script type="text/javascript"><!--
													google_ad_client = "ca-pub-4975603569119809";
													/* showdomain 468x60 */
													google_ad_slot = "3934035319";
													google_ad_width = 468;
													google_ad_height = 60;
													//-->
													</script>
													<script type="text/javascript"
													src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
													</script>
												</div>
												
												<h4>Best of 1 positions for <%=keyword.getDomain() %></h4>
												<ul>
													<li>
														<%=keyword.getBest1position() %>
													</li>
												</ul>
												
												<h4>Best of 2-5 positions for <%=keyword.getDomain() %></h4>
												<ul>
													<li>
														<%=keyword.getBest2positions() %>
													</li>
												</ul>
												
												<h4>Best of 6-10 positions for <%=keyword.getDomain() %></h4>
												<ul>
													<li>
														<%=keyword.getBest10positions() %>
													</li>
												</ul>
											</div>
										</div>
										<% } %>
									</div>
								</div>
								
							</section>
							<% } %>
						</div>
					</div>
				</section>
			</div>
			<!-- Left Content END -->
			
			<jsp:include page="/elements/right.jsp" />
		</div>
		
		
	</div>
		
<jsp:include page="/layouts/footer.jsp" />